<?php
require_once("xforms/Core.php");

class XForms_item extends XForms_core {
  protected $tpl = '<option>{renderLabel}</option>';
  function __construct($node, $xforms_processor){
    parent::__construct($node, $xforms_processor);
    $parentNodeName = $this->node->parentNode->nodeName;
    if($parentNodeName=="xforms:select1") {
      $this->tpl = '<option {renderValue}>{renderLabel}</option>';
    }
    if($parentNodeName=="xforms:select") {
      $this->tpl = '<input type="checkbox" {renderName} {renderValue} />{renderLabel}<br />';
    }
  }
  function renderName(){
    return ' name="'. $this->node->parentNode->getAttribute("id") . '"';
  }
  function renderLabel(){
    return $this->renderChildNodes(array("xforms:label"));
  }
  function renderValue(){
    return ' value="'.htmlentities($this->renderChildNodes(array("xforms:value")), ENT_QUOTES, 'utf-8').'"';
  }
}
